<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
asdasdasdas
</body>
<script>
    function dddd() {
        //添加 div
        var div = document.createElement("div");
        //设置 div 属性，如 id
        div.setAttribute("id", "newDiv");
    }

</script>
</html>